Option Strict Off
Option Explicit On
Friend Class frmDiagnostics
	Inherits System.Windows.Forms.Form
	'Declares that enable the display of memory status
	
	Private Structure MEMORYSTATUS
		Dim dwLength As Integer
		Dim dwMemoryLoad As Integer
		Dim dwTotalPhys As Integer
		Dim dwAvailPhys As Integer
		Dim dwTotalPageFile As Integer
		Dim dwAvailPageFile As Integer
		Dim dwTotalVirtual As Integer
		Dim dwAvailVirtual As Integer
	End Structure
	
	'UPGRADE_WARNING: Structure MEMORYSTATUS may require marshalling attributes to be passed as an argument in this Declare statement. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="C429C3A5-5D47-4CD9-8F51-74A1616405DC"'
	Private Declare Sub GlobalMemoryStatus Lib "kernel32" (ByRef lpBuffer As MEMORYSTATUS)
	
	Dim ms As MEMORYSTATUS
	
	Private Sub frmDiagnostics_Load(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles MyBase.Load
		
		Me.Top = 0 : Me.Left = VB6.TwipsToPixelsX((VB6.PixelsToTwipsX(System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width)) - (413 * VB6.TwipsPerPixelX))
		Me.Width = VB6.TwipsToPixelsX((400 * VB6.TwipsPerPixelX))
		Me.Height = VB6.TwipsToPixelsY((850 * VB6.TwipsPerPixelY))
		Me.lstVariables.Top = 0
		Me.lstVariables.Left = 0
		Me.lstVariables.Height = VB6.PixelsToTwipsY(Me.Height) - TitleHeight
		Me.lstVariables.Width = VB6.PixelsToTwipsX(Me.Width) - 20
	End Sub
	
	Public Sub ShowDiagnostics()
		If DiagnosticsYesNo = False Then Exit Sub 'Diagnostics may not be required. This is set at the start of the program (frmMain)
		Me.lstVariables.Items.Clear()
		Me.lstVariables.Items.Add(("ErrorLoggingYesNO = " & ErrorLoggingYesNO))
		Me.lstVariables.Items.Add(("ProjName = " & ProjName))
		Me.lstVariables.Items.Add(("SavePath = " & SavePath))
		Me.lstVariables.Items.Add(("XSheetName = " & XSheetName))
		Me.lstVariables.Items.Add(("XSheetOffset = " & XSheetOffset))
		Me.lstVariables.Items.Add(("SoundTrackName = " & SoundTrackName))
		Me.lstVariables.Items.Add(("SoundTrackAccuracy = " & SoundTrackAccuracy))
		Me.lstVariables.Items.Add(("SoundTrackOnOff = " & SoundTrackOnOff))
		Me.lstVariables.Items.Add(("ChromaKeyingYesNO = " & ChromaKeyingYesNO))
		Me.lstVariables.Items.Add(("ChromaType = " & ChromaType))
		Me.lstVariables.Items.Add(("ChromaBackground = " & ChromaBackground))
		Me.lstVariables.Items.Add(("ActiveWindowIs = " & ActiveWindowIs))
		Me.lstVariables.Items.Add(("OutputBmpFramesYesNo = " & OutputBmpFramesYesNo))
		Me.lstVariables.Items.Add(("SoundsOnOff = " & SoundsOnOff))
		Me.lstVariables.Items.Add(("MouthShapeOnOff = " & MouthShapeOnOff))
		Me.lstVariables.Items.Add(("FrameNum = " & FrameNum))
		Me.lstVariables.Items.Add(("Ascii01 = " & Ascii01 & "          " & Chr(Ascii01) & "   Capture 1"))
		Me.lstVariables.Items.Add(("Ascii02 = " & Ascii02 & "          " & Chr(Ascii02) & "   Capture 2"))
		Me.lstVariables.Items.Add(("Ascii03 = " & Ascii03 & "          " & Chr(Ascii03) & "   To Start"))
		Me.lstVariables.Items.Add(("Ascii04 = " & Ascii04 & "          " & Chr(Ascii04) & "   Back 1"))
		Me.lstVariables.Items.Add(("Ascii05 = " & Ascii05 & "          " & Chr(Ascii05) & "   Stop"))
		Me.lstVariables.Items.Add(("Ascii06 = " & Ascii06 & "          " & Chr(Ascii06) & "   Play"))
		Me.lstVariables.Items.Add(("Ascii07 = " & Ascii07 & "          " & Chr(Ascii07) & "   Forward 1"))
		Me.lstVariables.Items.Add(("Ascii08 = " & Ascii08 & "          " & Chr(Ascii08) & "   To End"))
		Me.lstVariables.Items.Add(("Ascii09 = " & Ascii09 & "          " & Chr(Ascii09) & "   Loop"))
		Me.lstVariables.Items.Add(("Ascii10 = " & Ascii10 & "          " & Chr(Ascii10) & "   Exit"))
		Me.lstVariables.Items.Add(("Ascii11 = " & Ascii11 & "          " & Chr(Ascii11) & "   Toggle"))
		Me.lstVariables.Items.Add(("Ascii12 = " & Ascii12 & "          " & Chr(Ascii12) & "   Time Lapse"))
		Me.lstVariables.Items.Add(("Ascii13 = " & Ascii13 & "          " & Chr(Ascii13) & "   Onion Skin"))
		Me.lstVariables.Items.Add(("Ascii14 = " & Ascii14 & "          " & Chr(Ascii14) & "   Settings"))
		Me.lstVariables.Items.Add(("Ascii15 = " & Ascii15 & "          " & Chr(Ascii15) & "   Utilities"))
		Me.lstVariables.Items.Add(("Ascii16 = " & Ascii16 & "          " & Chr(Ascii16) & "   Editor"))
		Me.lstVariables.Items.Add(("Ascii17 = " & Ascii17 & "          " & Chr(Ascii17) & "   Rotoscope"))
		Me.lstVariables.Items.Add(("Ascii18 = " & Ascii18 & "          " & Chr(Ascii18) & "   Undo"))
		'  frmDiagnostics.lstVariables.AddItem ("OutputBmpFramesYesNo = " & OutputBmpFramesYesNo)
		' frmDiagnostics.lstVariables.AddItem ("OutputJpgFramesYesNo = " & OutputJpgFramesYesNo)
		Me.lstVariables.Items.Add(("FrameNumberStampYesNo = " & FrameNumberStampYesNo))
		Me.lstVariables.Items.Add(("JpegQuality = " & JpegQuality))
		Me.lstVariables.Items.Add(("NumFramesPerClick = " & NumFramesPerClick))
		'  frmDiagnostics.lstVariables.AddItem ("WindowAtFront = " & WindowAtFront)
		Me.lstVariables.Items.Add(("PlayStatus = " & PlayStatus))
		Me.lstVariables.Items.Add(("ShowingLive = " & ShowingLive))
		Me.lstVariables.Items.Add(("RotoScopeSyncYesNo = " & RotoScopeSyncYesNo))
		Me.lstVariables.Items.Add(("TimePosition = " & TimePosition))
		Me.lstVariables.Items.Add(("CaptureQuality = " & CaptureQuality))
		Me.lstVariables.Items.Add(("LiveTime = " & LiveTime))
		Me.lstVariables.Items.Add(("ShutterMacroYesNo = " & ShutterMacroYesNo))
		Me.lstVariables.Items.Add(("MacroFilename = " & MacroFilename))
		Me.lstVariables.Items.Add(("Red = " & Red & "   Green = " & Green & "   Blue = " & Blue))
		Me.lstVariables.Items.Add(("Screen.TwipsPerPixelX = " & VB6.TwipsPerPixelX & "   Screen.TwipsPerPixelY = " & VB6.TwipsPerPixelY))
		Me.lstVariables.Items.Add(("TimeLapseOnYesNo = " & TimeLapseOnYesNo))
		Me.lstVariables.Items.Add(("TimeLapseDelay = " & TimeLapseDelay & " milliseconds"))
		Me.lstVariables.Items.Add(("XsheetOnOff = " & XsheetOnOff))
		Me.lstVariables.Items.Add(("CurrentlyActiveWindow = " & CurrentlyActiveWindow))
		'UPGRADE_ISSUE: ObjPtr function is not supported. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="367764E5-F3F8-4E43-AC3E-7FE0B5E074E2"'
        If Not PlayBackMediaControl Is Nothing Then
            Me.lstVariables.Items.Add(("Playback Media Player = Loaded "))
        Else
            Me.lstVariables.Items.Add(("Playback Media Player = Empty "))
        End If
		'UPGRADE_ISSUE: ObjPtr function is not supported. Click for more: 'ms-help://MS.VSCC.v90/dv_commoner/local/redirect.htm?keyword="367764E5-F3F8-4E43-AC3E-7FE0B5E074E2"'
        If Not RotoScopeMediaControl Is Nothing Then
            Me.lstVariables.Items.Add(("Rotoscope Media Player = Loaded "))
        Else
            Me.lstVariables.Items.Add(("Rotoscope Media Player = Empty "))
        End If
		
		' query for memory data
		ms.dwLength = Len(ms)
		GlobalMemoryStatus(ms)
		Me.lstVariables.Items.Add(" ")
		Me.lstVariables.Items.Add("MEMORY STATUS")
		Me.lstVariables.Items.Add("Total physical memory = " & VB6.Format(ms.dwTotalPhys / 1024, "###,###,###K"))
		Me.lstVariables.Items.Add("Available physical memory = " & VB6.Format(ms.dwAvailPhys / 1024, "###,###,###K"))
		Me.lstVariables.Items.Add("Memory Load = " & ms.dwMemoryLoad & "%")
		Me.lstVariables.Items.Add("Total Page file = " & VB6.Format(ms.dwTotalPageFile / 1024, "###,###,###K"))
		Me.lstVariables.Items.Add("Available Page file = " & VB6.Format(ms.dwAvailPageFile / 1024, "###,###,###K"))
		Me.lstVariables.Items.Add("Total Virtual memory = " & VB6.Format(ms.dwTotalVirtual / 1024, "###,###,###K"))
		Me.lstVariables.Items.Add("Available Virtual memory = " & VB6.Format(ms.dwAvailVirtual / 1024, "###,###,###K"))
		Me.Refresh()
	End Sub
End Class